/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.ucase.payment.controller;

import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.ucase.payment.dto.*;
import com.icinfo.cloud.provider.punish.ucase.payment.model.PaymentResultInfo;
import com.icinfo.cloud.provider.punish.ucase.payment.service.ICasePaymentResultRecordService;
import com.icinfo.cloud.provider.punish.ucase.payment.vo.CasePaymentResultRecordVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 描述: 案件缴款结果记录表 case_payment_result_record 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年03月02日
 */
@RestController
@RequestMapping("/punish/ucase/payment/result/record")
@Slf4j
public class CasePaymentResultRecordController extends BaseController {
    @Resource
    private ICasePaymentResultRecordService casePaymentResultRecordService;

    /**
     * 【V1.0.0】描述：保存案件缴款结果记录信息
     *
     * @param saveDto {@link CasePaymentResultRecordSaveDto}
     * @return {@link Result <String>} 保存结果
     * @author xiangyuyu
     * @date 2022-03-02 15:23
     */
    @PostMapping("/saveCasePaymentResultRecordInfo")
    @ApiOperation(value = "【V1.0.0】描述：保存案件缴款结果记录信息", httpMethod = "POST")
    public Result<String> saveCasePaymentResultRecordInfo(@RequestBody @Validated CasePaymentResultRecordSaveDto saveDto) {
        return casePaymentResultRecordService.saveCasePaymentResultRecordInfo(saveDto);
    }

    /**
     * 【V1.0.0】描述：获取案件缴款结果记录详情
     *
     * @param queryDto {@link CasePaymentResultRecordQueryDto}
     * @return {@link Result<CasePaymentResultRecordVo>} 案件缴款结果记录详情
     * @author xiangyuyu
     * @date 2022-03-02 15:23
     */
    @PostMapping("/getCasePaymentResultRecordDetail")
    @ApiOperation(value = "【V1.0.0】描述：获取案件缴款结果记录详情列表", httpMethod = "POST")
    public Result<CasePaymentResultRecordVo> getCasePaymentResultRecordDetail(@RequestBody @Validated CasePaymentResultRecordQueryDto queryDto) {
        CasePaymentResultRecordVo vo = casePaymentResultRecordService.getCasePaymentResultRecordDetail(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    /**
     * 【V1.3.1】描述：查询统一支付缴款结果信息
     *
     * @param queryDto {@link PaymentResultInfoDto}
     * @return {@link Result<PaymentResultInfo>} 支付结果信息
     * @author xiangyuyu
     * @date 2022-07-11 16:25
     */
    @PostMapping("/getPaymentResultInfo")
    @ApiOperation(value = "【V1.3.1】描述：查询统一支付缴款结果信息", httpMethod = "POST")
    public Result<PaymentResultInfo> getPaymentResultInfo(@RequestBody @Validated BusQueryPayStatusModelDto queryDto) {
        PaymentResultInfo paymentResultInfo = casePaymentResultRecordService.getPaymentResultInfo(queryDto);
        return Result.success(paymentResultInfo);
    }

    /**
     * 【V1.3.1】描述：获取统一支付缴款结果保存并进行案件处理
     *
     * @param dto {@link PaymentResultDealDto}
     * @return {@link Result<String>} 操作结果
     * @author xiangyuyu
     * @date 2022-07-12 19:33
     */
    @PostMapping("/savePaymentResultAndDealCaseInfo")
    @ApiOperation(value = "【V1.3.1】描述：获取统一支付缴款结果保存并进行案件处理", httpMethod = "POST")
    public Result<String> savePaymentResultAndDealCaseInfo(@RequestBody @Validated PaymentResultDealDto dto) {
        return casePaymentResultRecordService.savePaymentResultAndDealCaseInfo(dto);
    }


    /**
     * 批量处理：缴款后，没有自动生成执行情况核查记录文书的问题
     */
    @GetMapping("/batchRebuildExecuteCheckDoc")
    public Result<Boolean> batchRebuildExecuteCheckDoc(@RequestParam("caseId") String caseId) {
        return Result.success(casePaymentResultRecordService.batchRebuildExecuteCheckDoc(caseId));
    }

}